package com.nhncorp.neptune.tabletserver;

import com.nhncorp.neptune.client.Cell;
import com.nhncorp.neptune.client.Row;

import junit.framework.TestCase;

public class TestMapFileIndexRecord extends TestCase {
  public void testComparable() {
    MapFileIndexRecord r1 = new MapFileIndexRecord(new Row.Key(new String("1529676730")), new Cell.Key(""));
    MapFileIndexRecord r2 = new MapFileIndexRecord(new Row.Key(new String("1529676730")), new Cell.Key(""));
    MapFileIndexRecord r3 = new MapFileIndexRecord(new Row.Key(new String("1529676729")), new Cell.Key(""));
    
    assertFalse(r1.equals(null));
    
    try {
      r1.compareTo(null);
      assertTrue(false);
    } catch(NullPointerException e) {
    } catch(Exception e) {
      e.printStackTrace();
      assertTrue(false);
    }
    
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));
    assertFalse(r1.equals(r3));
    assertFalse(r3.equals(r2));

    assertTrue(r1.compareTo(r2) == 0);
    assertTrue(r2.compareTo(r1) == 0);
    
    assertTrue(r1.compareTo(r3) > 0);
    assertTrue(r3.compareTo(r2) < 0);
  }
}
